import React, { Component } from 'react';
import './App.css';
import GridTable from './components/common/GridTable';

class App extends Component {
    render() {
        var orderBy = {
            name	:	"create_time",
            type	:	"desc"
        };
        var titles = [
            {
                name:"姓名"
            },
            {
                name:"年龄"
            }
        ];
        var cols = [
            {
                name:"name",
                showTitle:false
            },
            {
                name:"age",
                formatter:function(v){
                    return "f:" + v;
                },
                ajax:function(v){

                }
            }
        ];

        var showPage = true;
        var payload = {"age":"10"};

        var onBefore = function(){
            console.log("componentWillMount--onBefore----------");
        };
        var onAfter = function(data){
            console.log("componentDidUpdate--onAfter----------" + JSON.stringify(data));
        };
        var id = "table";
        return (
            <GridTable id={id}
            url="http://localhost:8000/mock/getPage"
            orderBy={orderBy}
            titles={titles}
            cols={cols}
            showPage={showPage}
            payload={payload}
            onBefore={onBefore}
            onAfter={onAfter}
            />
        );
    }
}

export default App;
